# coding:utf-8

from util.opera_excel import OperaExcel
import sys
sys.path.append('D:/test/Appium2021')
class GetData:
    def __init__(self):
        self.opera_excel = OperaExcel()

    def get_case_lines(self):
        '''

        :return: 获取case的行数
        '''
        lines =self.opera_excel.get_lines()
        return lines
    def get_handle_step(self, row):
        '''
        获取操作步骤里的操作方法名字如：send_key
        :param row:
        :return:
        '''
        method_name = self.opera_excel.get_cell(row, 3)
        return method_name

    def get_element_key(self, row):
        '''
        获取操作元素的key
        :param row:
        :return:
        '''
        element_key = self.opera_excel.get_cell(row, 4)
        return element_key

    def get_handle_value(self, row):
        '''
        获取操作元素的值
        :param row:
        :return:
        '''
        handle_vlaue = self.opera_excel.get_cell(row, 5)
        return handle_vlaue
    def get_expect_element(self, row):
        '''
        获取预期结果元素的值
        :param row:
        :return:
        '''
        expect_element = self.opera_excel.get_cell(row, 6)
        return expect_element
    def get_is_run(self, row):
        is_run = self.opera_excel.get_cell(row, 9)
        if is_run == 'yes':
            return True
        else:
            return False

    def get_expct_handle(self, row):
        exoct_step = self.opera_excel.get_cell(row, 7)
        if exoct_step == "":
            return None
        return exoct_step


    def write_value(self, row, value):
        self.opera_excel.write_value(row, value)

if __name__ == '__main__':
    get =GetData()
    print(get.get_element_key(8))